A Multi-Agent System for Controlling Building Environments